class Solution:
    def smallestTrimmedNumbers(self, nums: List[str], queries: List[List[int]]) -> List[int]:
        result = []
        # m表示第几个最小的
        # n表示留下几个位数
        for m, n in queries:
            new_nums = [num[-n:] for num in nums]
            nums_tuple = [(num, idx) for idx, num in enumerate(new_nums)]
            idx = sorted(nums_tuple)[m-1][1]
            result.append(idx)
            
        return result